<template>
    <div v-if="isShow">
        <a class="btn btn-success btn-xs" v-on:click="pass2(index)" name="pass2">通过</a>&nbsp;<a class="btn btn-danger btn-xs" v-on:click="reject2(index)" name="reject2">驳回</a>
    </div>
    <div v-else>
        <a class="btn btn-success btn-xs" disabled v-on:click="pass2(index)" name="pass2">通过</a>&nbsp;<a class="btn btn-danger btn-xs" disabled v-on:click="reject2(index)" name="reject2">驳回</a>
        
    </div>
</template>
<script>
    export default {
        data() {
            return {
                isShow: false,

            }
        },
        methods: {
            pass2(index) {
                this.$parent.pass2(index)
            },
            reject2(index) {
                this.$parent.reject2(index)
            },
            getAuthority() {
                var _this = this
                $.ajax({
                    type: 'POST',
                    url: 'http://192.168.1.66:808/api/security/fetchuserfunctionlist',
                    data: {
                        'token': localStorage.token,
                        'userid': localStorage.userid,
                        'teamid': localStorage.activeteamid,
                    },
                    async: false,
                    dataType: 'json',
                    crossDomain: true,
                    error: function(request) {
                        _this.$store.commit('showModal','连接错误')
                    },
                    success: function(retdata) {
                        for (var i = 0; i < retdata.Table2.length; i++) {
                            if (retdata.Table2[i].functionname == 'secondAgree') {
                                _this.isShow = true
                                break;
                            }
                        }
                    }
                });
            }
        },
        mounted() {
            this.getAuthority()
        },
        props: {
            index: ''
        }

    }
</script>
<style>

</style>